package org.apache.james.mime4j.field.address;

import java.util.ArrayList;

public class DomainList
{
  private ArrayList domains;

  public DomainList(ArrayList paramArrayList, boolean paramBoolean)
  {
    if (paramArrayList != null)
      if (paramBoolean)
      {
        localArrayList = paramArrayList;
        this.domains = localArrayList;
      }
    while (true)
    {
      while (true)
      {
        return;
        localArrayList = (ArrayList)paramArrayList.clone();
      }
      this.domains = new ArrayList(0);
    }
  }

  public String get(int paramInt)
  {
    if ((paramInt < 0) || (size() <= paramInt))
      throw new IndexOutOfBoundsException();
    return ((String)this.domains.get(paramInt));
  }

  public int size()
  {
    return this.domains.size();
  }

  public String toRouteString()
  {
    StringBuffer localStringBuffer = new StringBuffer();
    for (int i = 0; i < this.domains.size(); ++i)
    {
      localStringBuffer.append("@");
      localStringBuffer.append(get(i));
      if (i + 1 < this.domains.size())
        localStringBuffer.append(",");
    }
    return localStringBuffer.toString();
  }
}